package top.purity.server.tenant.domain;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Index;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Comment;
import top.purity.framework.orm.BaseDO;

/**
 * @version 1.0
 * @Author Lmh
 * @Description
 * @CreateTime 2023-09-22 22:00
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "tenant_user", indexes = {
        @Index(name = "idx_tc", columnList = "tenant_code", unique = true),
        @Index(name = "idx_tn", columnList = "tenant_name"),
        @Index(name = "idx_tp", columnList = "phone")
})
public class TenantUser extends BaseDO {

    @Column(name = "tenant_name", nullable = false, length = 50)
    @Comment("租户名称")
    private String tenantName;

    @Column(name = "tenant_code", nullable = false, unique = true, length = 50)
    @Comment("租户编号")
    private String tenantCode;

    @Column(name = "phone", nullable = false, unique = true, length = 24)
    @Comment("租户手机号")
    private String phone;

    @Column(name = "address", length = 300)
    @Comment("租户地址")
    private String address;

    @Column(name = "status", length = 1)
    @Comment("租户状态 0 禁用 1 启用")
    @ColumnDefault("1")
    private Boolean status;

}
